package com.maxlen.ware.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.maxlen.ware.entity.WareSkuEntity;
import com.maxlen.ware.entity.to.SkuHasStockTO;
import com.maxlen.ware.entity.vo.SkuIdAndWareIdVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 商品库存
 *
 * @author MaxLen
 * @email MaxLen@gmail.com
 * @date 2022-10-27 11:02:35
 */
@Mapper
public interface WareSkuDao extends BaseMapper<WareSkuEntity> {

    void updateStock(@Param("skuId") Long skuId, @Param("wareId") Long wareId, @Param("skuNum") Integer skuNum);

    List<SkuHasStockTO> getSkuHasStock(@Param("skuIds") List<Long> skuIdList);

    int lockStock(@Param("skuId") Long skuId,@Param("wareId") Long wareId, @Param("count") Integer count);

    List<SkuIdAndWareIdVO> getSkuIdAndWareId(List<Long> skuIdList);

    int unlockStock(@Param("skuId") Long skuId, @Param("wareId") Long wareId, @Param("count") Integer count);

//    List<WareSkuEntity> selectBatchSkuId(@Param("skuIds") List<Long> wareSkuIdList);
}
